use orbtk::prelude::*;

use crate::main_state::MainState;

widget!(MainView<MainState> { text: String });

impl Template for MainView {
    fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
        self.child(
            Stack::new()
                .margin(8)
                .spacing(4)
                .child(
                    TextBlock::new()
                        .text("Message counter example")
                        .style("header")
                        .build(ctx),
                )
                .child(
                    TextBlock::new()
                        .style("body")
                        .margin((0, 8, 0, 0))
                        .text(id)
                        .build(ctx),
                )
                .build(ctx),
        )
    }
}
